package com.wgy.designmode.action.visitor.element;

import com.wgy.designmode.action.visitor.visitor.ComputerPartVisitor;

import java.util.ArrayList;
import java.util.List;

public class Computer implements ComputerPart{

    private List<ComputerPart> computerParts = new ArrayList<>();

    {
        computerParts.add(new Mouse());
        computerParts.add(new Keyboard());
        computerParts.add(new Monitor());

    }
    @Override
    public void accept(ComputerPartVisitor computerPartVisitor) {
        for (ComputerPart computerPart : computerParts) {
            computerPart.accept(computerPartVisitor);
        }
    }
}
